Trilium supports simple backup scheme where it saves copy of the Database on these events:
So in total you'll have at most 4 backups from different points in time
which should protect you from various problems. These backups are stored
by default in backup directory placed in
the data directory.
This is only very basic backup solution, and you're encouraged to add some better backup solution - e.g. backing up the Database to cloud / different computer etc.
Note that Synchronization provides also some backup capabilities by its nature of distributing the data to other computers.
Next, select the backup file (.db or .tnbackup) from your device. The web client is optimized for handling large backups and is resilient to unstable network conditions, similar to the desktop application.
If your database is encrypted, you will be prompted to enter the password used for encrypting the backup file. Without the correct password, decryption and restoration cannot proceed.
Restoring a backup may take some time, depending on its size. Once it completes, Trilium will open the freshly restored database.
Let's assume you want to restore the weekly backup (only in .db format, .tnbackup files are not supported by this method), here's how to do it:
~/trilium-data as data directory
from now on~/trilium-data/backup/backup-weekly.db -
this is the Database backup.~/trilium-data/document.db,
~/trilium-data/document.db-waland ~/trilium-data/document.db-shm (latter
two files are auto generated)~/trilium-data/backup/backup-weekly.db to
~/trilium-data/document.db
chmod 600 document.db
Starting with version 0.105, the Trilium desktop client allows users to change the directory where backups are stored. Follow these steps to specify a custom backup directory:
Once you set a custom directory, all manual and automatic backups will be saved there. If the selected directory becomes unavailable, backups may fail or revert to the default location.
Trilium can secure the entire content of the database backup, ensuring it remains unreadable unless the correct password is provided. This is particularly useful for storing backups in unsecured locations, like network shares, unencrypted external drives, or cloud services.
Encrypted database backups use the Trilium Backup Container (.tnbackup) format, which relies on AES-256-GCM. This authenticated encryption mode scrambles the data and generates a tag confirming it hasn't been altered. The password itself isn't directly used as the key; it's processed through scrypt, a key derivation function designed to be slow and memory-intensive, making brute-force password guessing difficult even with powerful hardware. Each backup also receives a random 16-byte salt, ensuring that the same password never produces the same encryption key twice. Additionally, critical metadata such as chunk order, length, and header flags are cryptographically bound into the encryption (via "additional authenticated data"), preventing undetected tampering like reorder, truncate, or splice operations.
To enable encryption for automatic backups in the Desktop application:
Once encryption is enabled, all newly created backups (both automatic and manual) will be encrypted with the specified password. Backups created prior to enabling encryption will remain unsecured.
You can change the password anytime using the Change Password button. The new password will apply to backups created after the change.
To disable encryption, uncheck Settings → Backup → Enable Encryption.
Database backups can be optionally compressed to minimize storage footprint. This method is effective primarily when the database consists largely of text content. However, media files (images, videos, audio), along with PDF, ODF, and DOCX files, are already compressed in their original formats and won't benefit from further compression.
Compressed backups are stored using the Trilium Backup Container (.tnbackup), employing RFC 1952 GZIP compression.
To enable compression for new automatic and manual backups, navigate to Settings → Backup → Backup Options and toggle Enable Compression to on.
Although this is not recommended, it is possible to disable backup in
config.iniin the data directory:
[General]
... some other configs
# set to true to disable backups (e.g. because of limited space on server)
noBackup=true
You can also review the configuration file
to provide all config.ini values as environment
variables instead.
See sample config.